package com.wolfstreet.wsonline;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import org.json.JSONObject;
import com.wolfstreet.wsonline.http.HttpHelper;
import com.wolfstreet.wsonline.http.HttpResponseListener;
import com.wolfstreet.wsonline.util.ToastUtil;

public class MainActivity extends AppCompatActivity implements HttpResponseListener {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);


        LoginHttp("asd", "asdsad");
    }


    public void LoginHttp(String tel, String pwd) {
        try {
            JSONObject json = new JSONObject();
            json.put("telephone", tel);
            json.put("password", pwd);

            HttpHelper.send("https://192.168.2.139/test/first.ashx", json, this, 1, true);
        } catch (Exception e) {
            e.printStackTrace();
//            if (debug)
//                showShotToast("后台接口异常" + e.toString());
        }
    }

    @Override
    public void httpResponse(String data, int code, String message, int id) {
        ToastUtil.showShotToast(data);
    }
}
